package chapter4.staticmethod;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2019-03-20 下午4:13
 */

class A {
    void print(String str) {
        System.out.println(str);
    }
}

class B {
    void fun(A a) {
        a.print("hello");
    }
}

public class TestDemo {
    private int cnt;

    public static void main(String[] args) {
        B b = new B();
        b.fun(new A() {
            int count;

            {
                count = 1;
            }

            @Override
            void print(String str) {
                System.out.println("override hello " + str);
                System.out.println("count:" + this.count);
            }
        });
    }
}
